import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_widgets_pc/resources/kq_theme_colors.dart';
import 'package:flutter_widgets_pc/utils/dialog_util.dart';
import 'package:flutter_widgets_pc/utils/toast_util.dart';
import 'package:flutter_widgets_pc/widgets/bottomTabBar/kq_bottom_tab_bar.dart';
import 'package:flutter_widgets_pc/widgets/button/kq_count_down_button.dart';
import 'package:flutter_widgets_pc/widgets/button/kq_head_button.dart';
import 'package:flutter_widgets_pc/widgets/button/kq_outline_button.dart';
import 'package:flutter_widgets_pc/widgets/checkbox/round_checkbox.dart';
import 'package:flutter_widgets_pc/widgets/chooseItemView/kq_choose_item_view.dart';
import 'package:flutter_widgets_pc/widgets/detailsItemView/kq_details_item_view.dart';
import 'package:flutter_widgets_pc/widgets/formItem/entity/kq_form_entity.dart';
import 'package:flutter_widgets_pc/widgets/formItem/kq_edit_more_view.dart';
import 'package:flutter_widgets_pc/widgets/formItem/kq_header_item_view.dart';
import 'package:flutter_widgets_pc/widgets/formItem/kq_more_auto_view.dart';
import 'package:flutter_widgets_pc/widgets/image/kq_image.dart';
import 'package:flutter_widgets_pc/widgets/noticeView/kq_notice_view.dart';
import 'package:flutter_widgets_pc/widgets/progressbar/kq_dashboard_progress_bar.dart';
import 'package:flutter_widgets_pc/widgets/progressbar/kq_horizontal_progress_bar.dart';
import 'package:flutter_widgets_pc/widgets/progressbar/ring_progress_bar.dart';
import 'package:flutter_widgets_pc/widgets/rainbowBar/kq_rainbow_bar.dart';
import 'package:flutter_widgets_pc/widgets/rainbowBar/kq_rainbow_tips_builder.dart';
import 'package:flutter_widgets_pc/widgets/rainbowBar/kq_rainbow_value.dart';
import 'package:flutter_widgets_pc/widgets/searchBar/kq_search_bar.dart';
import 'package:flutter_widgets_pc/widgets/seekbar/one_button_seek_bar.dart';
import 'package:flutter_widgets_pc/widgets/seekbar/two_button_seek_bar.dart';
import 'package:flutter_widgets_pc/widgets/selectTag/kq_select_tag.dart';
import 'package:flutter_widgets_pc/widgets/specialView/kq_special_view.dart';
import 'package:flutter_widgets_pc/widgets/steps/kq_horizontal_steps.dart';
import 'package:flutter_widgets_pc/widgets/swipeItem/kq_swipe_delete_item.dart';
import 'package:flutter_widgets_pc/widgets/tabView/kq_tab_view.dart';
import 'package:flutter_widgets_pc/widgets/tagView/kq_icon_tag.dart';
import 'package:flutter_widgets_pc/widgets/tagView/kq_number_tag_view.dart';
import 'package:flutter_widgets_pc/widgets/tagView/kq_tag_view.dart';
import 'package:flutter_widgets_pc/widgets/textFiled/kq_textfiled.dart';
import 'package:flutter_widgets_pc/widgets/titleBar/kq_title_bar.dart';
import 'package:get/get.dart';

import '../../resources/Images.dart';
import '../../router/route_map.dart';

/// 自定义控件演示页面
class CustomViewsPage extends StatefulWidget {
  const CustomViewsPage({super.key});

  @override
  State<StatefulWidget> createState() {
    return CustomViewsPageState();
  }
}

class CustomViewsPageState extends State<CustomViewsPage> {
  final GlobalKey<CustomViewsPageState> key = GlobalKey();
  final GlobalKey<KqRainbowBarState> keyRainbowBar =
      GlobalKey<KqRainbowBarState>();

  TitleBarShowMode titleMode = TitleBarShowMode.normal;

  var checked = false;

  var titles = ['One', 'Two', 'Three', 'Four', 'Five', 'Six'];
  var _selectedIndex = 0;
  int current = 0;
  List steps = [
    {'title': '咨询单填写', 'state': '2'},
    {'title': '提交询价', 'state': '1'},
    {'title': '办事处回复', 'state': '0'}
  ];

  String testText = "";

  KqFormEntity moreEntity = KqFormEntity(
      itemType: ItemType.custom,
      title: '复合板',
      hint: '请输入',
      mustInput: true,
      showUnit: false);
  KqFormEntity unitEntity = KqFormEntity(
      itemType: ItemType.custom,
      title: '复合板',
      hint: '请输入',
      mustInput: true,
      showUnit: true);

  KqFormEntity spec = KqFormEntity(
      itemType: ItemType.custom,
      mustInput: true,
      editable: true,
      // extraData: [
      //   KqFormBaseEntity(valueForShow: 'dsff'),
      //   KqFormBaseEntity(valueForShow: 'ewwewedd'),
      // ],
      title: '模仁');

  @override
  Widget build(BuildContext context) {
    return GestureDetector(
      onTap: () {
        keyRainbowBar.currentState?.closeTips();
      },
      child: Scaffold(
        appBar: KqHeadBar(
            headTitle: "自定义控件演示",
            back: () => Get.back(),
            showMode: titleMode,
            onCancelSearch: () {
              setState(() {
                titleMode = TitleBarShowMode.normal;
              });
            },
            onSearchSubmit: (value, state) => KqToast.showNormal(value),
            onSearchMonitor: (str) => KqToast.showNormal(str),
            onSearchCleared: () => KqToast.showNormal('清空'),
            actions: [
              KqHeadButton(
                buttonType: KqHeadButtonType.icon,
                widget: Icon(Icons.search,
                    size: 20, color: KqThemeColors.bgWhite),
                onTap: () {
                  setState(() {
                    titleMode = TitleBarShowMode.search;
                  });
                },
              ),
              KqHeadButton(
                buttonType: KqHeadButtonType.icon,
                widget: Icon(Icons.more_vert, size: 20, color: KqThemeColors.bgWhite),
                menuData: [
                  KqPopMenuItemData(
                      title: "审核",
                      imageUrl: Images.demoEditor,
                      hasPermission: true),
                  KqPopMenuItemData(
                      title: "很长很长很长很长很长", imageUrl: Images.demoIcSancu),
                ],
                onSelected: (position, entity) {
                  if (position == 0) {
                    RouteMap.pushTableDemo();
                  }
                },
              )
            ]),
        body: SingleChildScrollView(
          padding: EdgeInsets.symmetric(horizontal: 20, vertical: 20),
          child: Column(
            children: [
              KqHeaderItemView(entity: KqFormEntity(title: 'KqTagView演示')),
              Row(
                children: [
                  KqTagView(
                    text: '待生产',
                    textColor: KqThemeColors.textYellow,
                    borderColor: KqThemeColors.textYellow,
                    radius: 2,
                  ),
                  SizedBox(
                    width: 10,
                    height: 1,
                  ),
                  KqTagView(
                    text: '生产中',
                    textColor: KqThemeColors.textGreen,
                    borderColor: KqThemeColors.textGreen,
                    radius: 2,
                  ),
                  SizedBox(
                    width: 10,
                    height: 1,
                  ),
                  KqTagView(
                    text: '已完成',
                    textColor: KqThemeColors.textRed,
                    borderColor: KqThemeColors.textRed,
                    radius: 2,
                  ),
                  SizedBox(
                    width: 10,
                    height: 1,
                  ),
                  KqTagView(
                    text: '已挂起',
                    dashLine: true,
                    textColor: KqThemeColors.textYellow,
                    borderColor: KqThemeColors.textYellow,
                    radius: 2,
                  ),
                  SizedBox(
                    width: 10,
                    height: 1,
                  ),
                  KqTagView(
                    text: '带背景色',
                    dashLine: true,
                    backgroundColor: KqThemeColors.textGreen,
                    textColor: KqThemeColors.textLightBlue,
                    borderColor: KqThemeColors.bgWhite,
                    radius: 2,
                  ),
                ],
              ),
              SizedBox(
                width: 1,
                height: 10,
              ),
              KqHeaderItemView(entity: KqFormEntity(title: "KqImage 演示")),
              Row(
                children: [
                  KqImage(
                    imageType: ImageType.http,
                    radius: 10,
                    url:
                        'https://img1.baidu.com/it/u=2527732730,3137228782&fm=253&app=138&size=w931&n=0&f=JPEG&fmt=auto?sec=1677949200&t=615911fe42ee6d10a288bba35771b868',
                    width: 100,
                    height: 100,
                    fit: BoxFit.cover,
                  ),
                  SizedBox(
                    width: 10,
                    height: 10,
                  ),
                  KqImage(
                    imageType: ImageType.assets,
                    url: Images.homeIcTouxiang,
                    width: 100,
                    height: 100,
                    fit: BoxFit.cover,
                  )
                ],
              ),
              SizedBox(
                width: 1,
                height: 10,
              ),
              KqHeaderItemView(entity: KqFormEntity(title: 'IconTagView演示')),
              Row(
                children: [
                  KqIconTagView(
                    text: '已生产',
                    iconPath: Images.taskIcChanxian12Black,
                    textColor: KqThemeColors.textGreen,
                    backgroundColor: KqThemeColors.textRed,
                    // witdh: 100,
                  ),
                  SizedBox(
                    width: 10,
                    height: 1,
                  ),
                  KqIconTagView(
                    text: '生产中',
                    iconPath: Images.taskIcZhuangtai12Black,
                    backgroundColor: KqThemeColors.textYellow,
                    viewType: 2,
                  ),
                  SizedBox(
                    width: 10,
                    height: 1,
                  ),
                  KqIconTagView(
                    text: '水电费水电费撒发的发',
                    iconPath: Images.taskIcChanxian12Black,
                    textColor: KqThemeColors.textGreen,
                    // backgroundColor: KqThemeColors.textRed,
                    crossAxisAlignment: CrossAxisAlignment.start,
                    maxLines: 2,
                    iconHeight: 20,
                    width: 80,
                  ),
                  SizedBox(
                    width: 10,
                    height: 1,
                  ),
                  KqIconTagView(
                    text: '水电费水电费撒发的发',
                    iconPath: Images.taskIcChanxian12Black,
                    backgroundColor: KqThemeColors.textYellow,
                    crossAxisAlignment: CrossAxisAlignment.start,
                    leftText: '按时大大是的',
                    maxLines: 2,
                    viewType: 3,
                    iconWidth: 50,
                    width: 130,
                  ),
                  //  SizedBox(
                  //   width: 10,
                  //   height: 1,
                  // ),
                  // IconTagView(
                  //   text: '水电费水电费撒发的发',
                  //   iconPath: Images.taskIcChanxian12Black,
                  //   textColor: KqThemeColors.textGreen,
                  //   backgroudColor: KqThemeColors.textRed,
                  //   maxLines: 2,
                  //   witdh: 100,
                  // ),
                ],
              ),
              KqHeaderItemView(
                  entity: KqFormEntity(title: 'KqRainbowBar(彩虹条)演示')),
              Container(
                margin: EdgeInsets.fromLTRB(0, 10, 0, 0),
                padding: EdgeInsets.all(1),
                color: KqThemeColors.textCCC,
                child: Container(
                  color: Colors.white,
                  padding: EdgeInsets.all(2),
                  height: 24,
                  width: 304,
                  child: KqRainbowBar(
                    key: keyRainbowBar,
                    context: context,
                    tipsBuilder: KqRbTipsBuilder(
                      textStyle: TextStyle(
                        fontSize: 12,
                        color: Colors.white,
                      ),
                      radius: Radius.circular(4),
                      tipsOffset: 3,
                    ),
                    data: [
                      KqRainbowValue(
                          value: 20,
                          color: KqThemeColors.textGreen,
                          text: "工作\n2023-03-07 11:00 -> 2023-03-07 11:20"),
                      KqRainbowValue(
                          value: 20,
                          color: KqThemeColors.textRed,
                          text: "异常\n2023-03-07 11:20 -> 2023-03-07 11:40"),
                      KqRainbowValue(
                          value: 2,
                          color: KqThemeColors.textGreen,
                          text: "工作\n2023-03-07 11:40 -> 2023-03-07 11:42"),
                      KqRainbowValue(
                          value: 7,
                          color: KqThemeColors.text999,
                          text: "离线\n2023-03-07 11:42 -> 2023-03-07 11:49"),
                      KqRainbowValue(
                          value: 5,
                          color: KqThemeColors.textGreen,
                          text: "工作\n2023-03-07 11:49 -> 2023-03-07 11:54"),
                      KqRainbowValue(
                          value: 10,
                          color: KqThemeColors.textYellow,
                          text: "空闲\n2023-03-07 11:54 -> 2023-03-07 12:04"),
                      KqRainbowValue(
                          value: 20,
                          color: Colors.white,
                          text: "无状态\n2023-03-07 12:04 -> 2023-03-07 12:24"),
                      KqRainbowValue(
                          value: 40,
                          color: KqThemeColors.text999,
                          text: "离线\n2023-03-07 12:24 -> 2023-03-07 13:04"),
                      KqRainbowValue(
                          value: 10,
                          color: KqThemeColors.textYellow,
                          text: "空闲\n2023-03-07 13:04 -> 2023-03-07 13:14"),
                    ],
                    rainbowBarMoveListener: (position, dialogShowPositionLocal,
                        dialogShowPositionGlobal, value) {
                      KqToast.showNormal(position.toString());
                    },
                  ),
                ),
              ),
              SizedBox(
                width: 1,
                height: 10,
              ),
              KqHeaderItemView(
                  entity: KqFormEntity(title: 'KqNoticeView公告栏演示')),
              const KqNoticeView(
                content: '这是一条公告，内容很长很长很长很长很长很长很长很长。',
              ),
              SizedBox(
                width: 1,
                height: 10,
              ),
              KqHeaderItemView(
                  entity: KqFormEntity(title: 'KqDetailsItemView 通用详情Item演示')),
              KqDetailsItemView(
                title: '标题',
                showMustInput: true,
                content: '内容内容内容内容内容',
                expandContentEnable: true,
                showRightArrow: true,
                onTaped: () {
                  KqToast.showNormal('111');
                },
              ),
              KqDetailsItemView(
                title: '标题',
                showMustInput: true,
                content:
                    '内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容',
                expandContentEnable: true,
                showRightArrow: true,
                onTaped: () {
                  KqToast.showNormal('111');
                },
              ),
              SizedBox(
                width: 1,
                height: 10,
              ),
              KqHeaderItemView(
                  entity: KqFormEntity(title: 'KqDragGridView 拖拽排序演示')),
              Row(
                children: [
                  KqOutlineButton(
                    title: '去演示（网格）',
                    onTap: () => RouteMap.pushDragGridViewDemo(),
                  ),
                  KqOutlineButton(
                    title: '去演示（列表）',
                    onTap: () => RouteMap.pushDragListViewDemoPage(),
                  ),
                  KqOutlineButton(
                    title: '去演示（仿抽屉）',
                    onTap: () => RouteMap.pushDragDrawerDemo(),
                  )
                ],
              ),
              SizedBox(
                width: 1,
                height: 10,
              ),
              KqHeaderItemView(entity: KqFormEntity(title: 'KqTabBar 演示')),
              Row(
                children: [
                  KqOutlineButton(
                    title: '去演示',
                    onTap: () {
                      RouteMap.pushTabBarDemo();
                    },
                  )
                ],
              ),
              SizedBox(
                width: 1,
                height: 10,
              ),
              KqHeaderItemView(entity: KqFormEntity(title: 'KqToast 演示')),
              Row(
                children: [
                  KqOutlineButton(
                    title: '普通Toast',
                    onTap: () {
                      KqToast.showNormal('这是一个普通的吐司');
                    },
                  ),
                  SizedBox(
                    width: 10,
                  ),
                  KqOutlineButton(
                    title: '成功Toast',
                    onTap: () {
                      KqToast.showSuccess('这是一个成功的吐司');
                    },
                  )
                ],
              ),
              KqHeaderItemView(
                  entity: KqFormEntity(
                      title: 'KqSectionGridView，KqSectionListView分区演示')),
              Row(
                children: [
                  KqOutlineButton(
                    title: '分区网格',
                    onTap: () => RouteMap.pusSectionGridViewDemo(),
                  ),
                  KqOutlineButton(
                      title: '分区列表',
                      onTap: () => RouteMap.pusSectionListView()),
                ],
              ),
              KqHeaderItemView(entity: KqFormEntity(title: 'ChartView 图表演示')),
              Row(
                children: [
                  KqOutlineButton(
                    title: '曲线折线图',
                    onTap: () => RouteMap.pushKqChartLineDemo(),
                  ),
                  KqOutlineButton(
                    title: '扇形分布图',
                    onTap: () => RouteMap.pushKqChartPieDemo(),
                  )
                ],
              ),
              KqHeaderItemView(
                  entity: KqFormEntity(title: 'KqNumberTagView 数字角标演示')),
              Row(
                children: [
                  KqNumberTagView(
                    number: 1,
                    backgroundColor: KqThemeColors.bgWhite,
                    borderColor: KqThemeColors.textRed,
                    borderWidth: 1,
                    textColor: KqThemeColors.textRed,
                  ),
                  SizedBox(
                    width: 5,
                    height: 1,
                  ),
                  KqNumberTagView(
                    number: 10,
                    max: 99,
                  ),
                  SizedBox(
                    width: 5,
                    height: 1,
                  ),
                  KqNumberTagView(
                    number: 1000,
                    backgroundColor: KqThemeColors.textLightBlue,
                  ),
                  SizedBox(
                    width: 5,
                    height: 1,
                  ),
                  KqNumberTagView(
                    number: 100,
                    max: 99,
                  ),
                ],
              ),
              KqHeaderItemView(
                  entity: KqFormEntity(title: 'RingProgressBar 带倒计时环型进度条')),
              RingProgressBar(
                radius: 50,
                strokeWidth: 10,
                isShowText: true,
                maxProgress: 10,
                callback: () {
                  print("callback回调了");
                },
              ),
              KqHeaderItemView(
                  entity:
                      KqFormEntity(title: 'KqHorizontalProgressBar 二级水平进度条')),
              SizedBox(
                width: 5,
                height: 4,
              ),
              KqHorizontalProgressBar(
                height: 12,
                progress: 80,
                secondProgress: 50,
                radius: 3,
                enableSecondProgress: true,
                secondProgressShape: SecondProgressShape.roundRect,
              ),
              SizedBox(
                width: 5,
                height: 4,
              ),
              KqHorizontalProgressBar(
                height: 12,
                progress: 60,
                secondProgress: 30,
                radius: 0,
                enableSecondProgress: true,
                secondProgressShape: SecondProgressShape.roundRect,
              ),
              SizedBox(
                width: 5,
                height: 4,
              ),
              KqHorizontalProgressBar(
                height: 12,
                progress: 50,
                secondProgress: 30,
                radius: 10,
                enableSecondProgress: true,
                secondProgressShape: SecondProgressShape.point,
              ),
              SizedBox(
                width: 5,
                height: 4,
              ),
              KqHeaderItemView(
                  entity: KqFormEntity(title: 'KqTextFiled 固定高度演示')),
              Container(
                width: context.width,
                height: 120,
                color: KqThemeColors.lineColor,
                padding: EdgeInsets.all(14),
                child: const KqTextFiled(
                  useParentHeight: true,
                  multiline: true,
                ),
              ),
              KqHeaderItemView(entity: KqFormEntity(title: 'KqSearchBar 演示')),
              Container(
                width: context.width,
                color: KqThemeColors.lineColor,
                child: KqSearchBar(
                  onSubmit: (value, state) => KqToast.showNormal(value),
                ),
              ),
              SizedBox(
                width: 1,
                height: 5,
              ),
              KqSearchBar(
                editable: false,
                enablePDAScan: true,
                autoFocusBorder: true,
                onSubmit: (value, state) => KqToast.showNormal(value),
              ),
              KqHeaderItemView(
                  entity:
                      KqFormEntity(title: 'TwoButtonSeekBar 带两个按钮的SeekBar')),
              TwoButtonSeekBar(
                valueMaxProgress: 100,
                valueOneSeekBar: 0,
                valueTwoSeekBar: 50,
                oneSeekBarValueFormat: (value) {
                  return "$value%";
                },
              ),
              KqHeaderItemView(
                  entity:
                      KqFormEntity(title: 'OneButtonSeekBar 带一个按钮的SeekBar')),
              OneButtonSeekBar(
                oneSeekBarValueFormat: (value) {
                  return "$value%";
                },
              ),
              const KqTabView(
                titles: ['删除Normal', '提交Normal'],
              ),
              SizedBox(
                width: 5,
                height: 4,
              ),
              const KqTabView(
                titles: ['保存Nomal', '提交Normal'],
                nomalTxtColors: [
                  KqThemeColors.textBlue,
                  KqThemeColors.textWhite
                ],
                nomalBgColors: [KqThemeColors.bgWhite, KqThemeColors.textBlue],
                nomalBorderColors: [KqThemeColors.bgBlue, KqThemeColors.bgBlue],
              ),
              SizedBox(
                width: 5,
                height: 4,
              ),
              const KqTabView(
                disable: true,
                titles: ['保存Disable', '提交Disable'],
                nomalTxtColors: [
                  KqThemeColors.textBlue,
                  KqThemeColors.textWhite
                ],
                nomalBgColors: [KqThemeColors.bgWhite, KqThemeColors.textBlue],
                nomalBorderColors: [KqThemeColors.bgBlue, KqThemeColors.bgBlue],
              ),
              SizedBox(
                width: 5,
                height: 4,
              ),
              KqSpecialView(
                  maxWidth: 90,
                  minWidth: 60,
                  onTap: (entity) {
                    KqDialog.showInputDialog('title',
                        onConfirm: ((value) {
                      List<KqFormBaseEntity> items = [];
                      if (entity.extraData != null &&
                          (entity.extraData as List).isNotEmpty) {
                        items = entity.extraData;
                      }
                      items.add(KqFormBaseEntity(valueForShow: value));
                      setState(() {
                        entity.extraData = items;
                      });
                    }));
                  },
                  entity: spec),
              KqSpecialView(
                  entity: KqFormEntity(
                      itemType: ItemType.custom,
                      mustInput: true,
                      editable: false,
                      valueForShow:
                          '能加分发你缝纫机ENFJ妇女节而那附近儿保附件二你姐夫可容纳副卡人,dsff,ewwewedd',
                      extraData: [
                        KqFormBaseEntity(
                            valueForShow: '能加分发你缝纫机ENFJ妇女节而那附近儿保附件二你姐夫可容纳副卡人'),
                        KqFormBaseEntity(valueForShow: 'dsff'),
                        KqFormBaseEntity(valueForShow: 'ewwewedd'),
                      ],
                      title: '模仁')),
              KqSpecialView(
                  isSeparate: true,
                  entity: KqFormEntity(
                      itemType: ItemType.custom,
                      mustInput: true,
                      editable: false,
                      valueForShow:
                          '能加分发你缝纫机ENFJ妇女节而那附近儿保附件二你姐夫可容纳副卡人,dsff,ewwewedd',
                      extraData: [
                        KqFormBaseEntity(
                            valueForShow: '能加分发你缝纫机ENFJ妇女节而那附近儿保附件二你姐夫可容纳副卡人'),
                        KqFormBaseEntity(valueForShow: 'dsff'),
                        KqFormBaseEntity(valueForShow: 'ewwewedd'),
                      ],
                      title: '模仁')),
              KqHeaderItemView(
                  entity: KqFormEntity(title: 'kqCountDownButton 倒计时按钮')),
              KqCountDownButton(
                countDownValue: 30,
                text: "点我测试",
                onTap: (state) {
                  state.startTimer();
                },
              ),
              KqMoreAutoView(
                data: moreEntity,
                didSelect: (entity) {
                  setState(() {
                    entity.title = '111';
                  });
                },
              ),
              KqMoreAutoView(data: unitEntity),
              KqHeaderItemView(
                  entity: KqFormEntity(
                      title: 'kqSwipeItem : kqSwipeDeleteItem 左滑删除控件')),
              KqSwipeDeleteItem(),
              KqHorizontalSteps(
                  controller: KqStepsController(currentIndex: 1),
                  callBack: ((index) {
                    setState(() {
                      if (current <= index) {
                        //当前点的是后面
                        if (steps.length > index) {
                          Map item = steps[index];
                          item['state'] = '1';
                        }
                      } else {
                        for (var i = index + 1; i <= current; i++) {
                          Map item = steps[i];
                          item['state'] = '0';
                        }
                      }
                      current = index;
                    });
                  }),
                  steps: steps.map((e) {
                    return KqStep(
                      stepContentText: e['title'],
                      state: e['state'] == '0'
                          ? KqStepState.indexed
                          : e['state'] == '1'
                              ? KqStepState.doing
                              : KqStepState.complete,
                      doingIcon: const Icon(
                        Icons.mode_standby,
                        color: KqThemeColors.textLightBlue,
                      ),
                    );
                  }).toList()),
              KqSwipeDeleteItem(),
              KqHeaderItemView(
                  entity: KqFormEntity(
                      title: 'KqTextFiled功能扩展，可监控TextFiled的输入停顿演示')),
              const Text("请连在下面的输入框续输入然后停顿："),
              KqTextFiled(
                onMonitor: (str) {
                  setState(() {
                    testText = "暂停输入，值：$str";
                  });
                },
              ),
              Text(testText),
              KqHeaderItemView(
                  entity:
                      KqFormEntity(title: 'KqDashboardProgressBar 驾驶舱进度条演示')),
              const KqDashboardProgressBar(
                centerText: "80",
                centerTextUnit: "%",
                bottomText: "底部文字",
                sweepScale: 80,
              ),
              KqEditMoreView(
                  entity: KqFormEntity(
                      title: '咨询',
                      mustInput: true,
                      backgroundColor: KqThemeColors.bgD,
                      paddingVertical: 10,
                      maxCharCount: 200,
                      counterText: null,
                      btnSpacing: 10)),
              SizedBox(
                width: 10,
                height: 20,
              ),
              KqHeaderItemView(entity: KqFormEntity(title: 'checkbox演示')),
              RoundCheckBox(
                onTap: (bool? check) {},
              ),
              KqHeaderItemView(
                  entity: KqFormEntity(title: 'KqChooseItemView 演示')),
              KqChooseItemView(
                title: "左边显示checkBox",
                direction: CheckBoxDirection.left,
                onItemTap: (checked) {
                  KqToast.showNormal("checked:$checked");
                },
              ),
              KqChooseItemView(
                title: "右边边显示checkBox",
                direction: CheckBoxDirection.right,
                disabled: true,
                isChecked: true,
                onItemTap: (checked) {
                  KqToast.showNormal("checked:$checked");
                },
              ),
              KqHeaderItemView(
                  entity: KqFormEntity(title: 'KqSelectTag 选择切换的长条(均分|滚动|换行)')),
              KqHeaderItemView(entity: KqFormEntity(title: '均分')),
              const KqSelectTag(
                tagList: ["当班", "上一班", "1天", "7天", "自定义"],
                mode: KqSelectTagMode.share,
                initChoose: false,
              ),
              KqHeaderItemView(entity: KqFormEntity(title: '滚动')),
              const KqSelectTag(
                tagList: [
                  "当班",
                  "上一班",
                  "1天",
                  "7天",
                  "自定义",
                  "当班",
                  "上一班",
                  "1天",
                  "7天",
                  "自定义"
                ],
                mode: KqSelectTagMode.scroll,
              ),
              KqHeaderItemView(entity: KqFormEntity(title: '换行')),
              const KqSelectTag(
                tagList: [
                  "当班",
                  "上一班",
                  "1天",
                  "7天",
                  "自定义",
                  "当班",
                  "上一班",
                  "1天",
                  "7天",
                  "自定义"
                ],
                mode: KqSelectTagMode.warp,
              ),
              KqHeaderItemView(entity: KqFormEntity(title: '自定义项')),
              KqSelectTag(
                tagList: [
                  "当班",
                  "上一班",
                  "1天",
                ],
                initChoose: false,
                mode: KqSelectTagMode.share,
                customItem: (int i, int? position, String text) {
                  return Container(
                    decoration: BoxDecoration(
                      color: position != null && position == i
                          ? KqThemeColors.textLightBlue
                          : KqThemeColors.textWhite,
                    ),
                    padding:
                        EdgeInsets.symmetric(horizontal: 20, vertical: 4),
                    child: Text(
                      text,
                      style: TextStyle(
                          fontSize: 12,
                          color: position != null && position == i
                              ? KqThemeColors.textWhite
                              : KqThemeColors.text333),
                      textAlign: TextAlign.center,
                    ),
                  );
                },
              ),
            ],
          ),
        ),
        bottomNavigationBar: KqBottomTabBar(
          icons: [
            Images.homeIcBanbenhao,
            Images.homeIcBanbenhao,
            Images.homeIcBanbenhao
          ],
          activeIcons: [
            Images.homeIcTouxiang,
            Images.homeIcTouxiang,
            Images.homeIcTouxiang
          ],
          titles: const ['首页', '工作台', '我的'],
          currentIndex: _selectedIndex,
          onTap: (value) {
            setState(() {
              _selectedIndex = value;
            });
            print(value);
          },
        ),
        // bottomNavigationBar: KqBottomTabBar(
        //   iconWidgets: [
        //     Image.asset(Images.homeIcBanbenhao),
        //     Image.asset(Images.homeIcBanbenhao),
        //     Image.asset(Images.homeIcBanbenhao)
        //   ],
        //   activeIconWidgets: [
        //     Image.asset(Images.homeIcTouxiang),
        //     Image.asset(Images.homeIcTouxiang),
        //     Image.asset(Images.homeIcTouxiang)
        //   ],
        //   titleWidgets: const [Text('首页'), Text('工作台'), Text('我的')],
        //   currentIndex: _selectedIndex,
        //   onTap: (value) {
        //     setState(() {
        //       _selectedIndex = value;
        //     });
        //     print(value);
        //   },
        // ),
      ),
    );
  }
}
